<?php include_once "top.php";?>
<div class="addleft">
	<a href="package.php">消费者礼包列表</a>
</div>
<div class="addbar">
	<ul>
	<h2>消费者礼包列表
		<input type="button" name="" value="导出全部消费者礼包" onclick="location.href='excel2.php?t=10&all=yes'" />
		<input type="button" name="" value="导出未发货消费者礼包"  onclick="location.href='excel2.php?t=10&all=no'" />
	</h2>
	<li class="lihd" style="width:115%"><strong align="center">
		<label style="width:200px">店铺名称</label>
		<label>店长</label>
		<label style="width:150px">手机号</label>
		<label style="width:200px">地址</label>
		<label>兑换数量</label>
		<label>状态</label>
		<label>兑换时间</label>
		<label>操作</label>
		</strong>
	</li>
	<?php 
	foreach($db->ig2_select('mae_shop_admin_exchange_list','1 order by is_delivery asc') as $list){
		$shop=$db->ig2_want('mae_shop','id='.$list['shop_id']);
		$admin=$db->ig2_want('mae_user','id='.$shop['admin_id']);
	?>
	<li align="center" style="width:115%">
		<label style="width:200px"><?php echo $shop['name']?></label>
		<label><?php echo $admin['name']?></label>
		<label style="width:150px"><?php echo $admin['phone']?></label>
		<label style="width:200px"><?php echo trim($admin['address'])?trim($admin['address']):'-'?></label>
		<label><?php echo $list['number']?></label>
		<label id="delivery_<?php echo $list['id']?>"><?php switch($list['is_delivery']){
			case 0 : echo '未发货'; break;
			case 1 : echo '已发货'; break;
			default : break;
		}?></label>
		<label><?php echo date('Y-m-d H:i:s',$list['create_time'])?></label>
		<label id="cz_<?php echo $list['id']?>"><?php echo $list['is_delivery']?'-':'<a href="javascript:void(0)" onclick="setExchangeList(\''.$list['id'].'\')">确认发货</a>'?></label>
	</li>
	<?php }?>
	</ul>
</div>
<script language="javascript">
function setExchangeList(id){
	$.ajax({
		type: "GET",
		url: "ra_ajax.php?set_exchange_list=1&id="+id,
		success: function(data){
			if(data == 'success'){
				$('#delivery_'+id).html('已发货');
				$('#cz_'+id).html('-');
			}
		}
	}); 
}
</script>
<?php include_once "down.php";?>